#include "MoreDetailDialog.h"
#include "../../../model/proxy/FightProxy.h"
#include "../../../model/proxy/UserProxy.h"
#include "../../../model/vo/DataVO.h"
#include "../../../model/static/StaticRole.h"

MoreDetailDialog::MoreDetailDialog()
	:mAttack(NULL),mDefense(NULL),mLife(NULL),
	mStrength(NULL),mAgility(NULL),mNaiLi(NULL),
	mQianNeng(NULL)
{

}

MoreDetailDialog::~MoreDetailDialog()
{
	CC_SAFE_RELEASE(mAttack);
	CC_SAFE_RELEASE(mDefense);
	CC_SAFE_RELEASE(mLife);
	CC_SAFE_RELEASE(mStrength);
	CC_SAFE_RELEASE(mAgility);
	CC_SAFE_RELEASE(mNaiLi);
	CC_SAFE_RELEASE(mQianNeng);
}

bool MoreDetailDialog::onAssignCCBMemberVariable( CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode )
{
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mAttack", CCLabelTTF *, this->mAttack);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mDefense", CCLabelTTF *, this->mDefense);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mLife", CCLabelTTF *, this->mLife);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mStrength", CCLabelTTF *, this->mStrength);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mAgility", CCLabelTTF *, this->mAgility);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mNaiLi", CCLabelTTF *, this->mNaiLi);
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mQianNeng", CCLabelTTF *, this->mQianNeng);

	return NULL;
}

bool MoreDetailDialog::init()
{
	ModelDialog::init();
	return true;
}

void MoreDetailDialog::onEnter()
{
	ModelDialog::onEnter();
	refresh();
}

void MoreDetailDialog::onExit()
{
	ModelDialog::onExit();
}

void MoreDetailDialog::refresh()
{
	UserVO& userVO = UserProxy::getSingletonPtr()->userVO;
	mAttack->setString(fcs("%d", userVO.atkMin));
	mDefense->setString(fcs("%d", userVO.defMin));
	mLife->setString(fcs("%d", userVO.life));
	mStrength->setString(fcs("%d", userVO.strength));
	mAgility->setString(fcs("%d", userVO.agility));
	mNaiLi->setString(fcs("%d", userVO.naili));
	mQianNeng->setString(fcs("%d", userVO.proficiency));
}

void MoreDetailDialog::touchScreen()
{
	close();
}
